cat('Creating Table A24 \n\n')

dat = read.csv('TableA24_data.csv')
non.south.dat = dat[dat$region != 'South',]


reg1 = lm(trump.vote~hisp.pct.change+male+D20+Quota_Sample_Age,
          data = dat)
clustered.se = cl(dat, reg1, dat$COUNTY)
reg1$se = clustered.se

reg2 = lm(trump.vote~hisp.pct.change+male+D20+Quota_Sample_Age+factor(S2),
          data = dat)
clustered.se = cl(dat, reg2, dat$COUNTY)
reg2$se = clustered.se

reg3 = lm(trump.vote~hisp.pct.change+male+D20+Quota_Sample_Age,
          data = non.south.dat)
clustered.se = cl(non.south.dat, reg3, non.south.dat$COUNTY)
reg3$se = clustered.se

reg4 = lm(trump.vote~hisp.pct.change+male+D20+Quota_Sample_Age+factor(S2),
          data = non.south.dat)
clustered.se = cl(non.south.dat.dat, reg4, non.south.dat$COUNTY)
reg4$se = clustered.se


outtable = apsrtable(reg1,
                     reg2,
                     reg3,
                     reg4,
                     Sweave = T,
                     notes = '',
                     stars = 'default'
)
writeLines(
  outtable, 'TableA24.tex')


